All Questions
Tagged with sortingjavascript
126 questions
3votes
1answer
123views
Sorting the divisors of a given number
I am trying to sort all the divisors of a given number in the most efficient way. Below is my code for sorting the divisors: ...
3votes
1answer
133views
How can I condense my code in node.js for sorting unique values within an array?
Kattis problem - ("I've been everywhere") I would highly recommend looking at the problem through the link, however I will summarize it a bit here and explain the functionality of each part ...
3votes
1answer
83views
Function that sorts nestedArray[][]'s
I'm fairly new to coding and am trying to learn more about best practices. I wanted to have an nestedArray of objectArrays, and I wanted to be able to sort the elements in each objectArray based on ...
0votes
1answer
297views
bubble sort algorithm with nested loops performs better than with one loop JS
Here are 2 bubble sort algorithms: 1: ...
1vote
6answers
239views
Find first and last matches on a sorted list
I needed a function to find the first and last indices into a sorted list corresponding to a given value (roughly similar to C++'s equal_range()). This is the ...
0votes
1answer
143views
Six different, concise (and hopefuly readable), sorting algorithms using ES6+ idioms, with some basic unit testing
I'm practicing js, unit testing, and algorithms, so implementing some of the common sorting algorithms and doing some basic unit testing on them seemed like a good exercise. I'm also trying to use ...
2votes
2answers
3kviews
Sorting table rows visually with animation while keeping them intact in the DOM
I have a table which i want to sort the rows visually according to a column while the rows remain intact in the DOM structure. So nodes aren't moving in the DOM or getting replaced with eachother at ...
0votes
1answer
215views
A New Sorting Algorithm
I have designed an Algorithm for sorting numbers. This algorithm works by sorting an array of any length with random, non-repeating whole numbers in a linear manner by ascending order. Under the ...
2votes
2answers
162views
Function to find substring in a list of strings and add them to the resulting list
I am trying to look for a substring in a list of strings. My end result is an array that contains the presence of substring first based on course.name and then ...
2votes
3answers
899views
Sort one array base on another array
The problem is as below: Two archery teams A and B compete with the same number of members. If the score of team A[i] is higher than that of team B[i], the total score of team A will be +1, so given ...
0votes
1answer
94views
custom array sorting algorithm
So I came up with a "new" sorting algorithm: ...
0votes
2answers
2kviews
Sort table with ascending or descending order without a library
This is my first day coding, and I need help with sorting a table in ascending/descending order. The idea is that when a column is clicked it will sort in ascending order, and then it is clicked again ...
2votes
2answers
1kviews
Using JavaScript, given a JSON value, recursively find all JSON objects, then sort keys in-place
Some background: JavaScript is not my primary language, so I'm looking to get some constructive criticism here. I built a tiny single page HTML app that pretty prints JSON text. It's very useful when ...
3votes
2answers
218views
Sorting an array of positive integers including 0 much faster than Radix Sort
I was working on an Limit Order Book structure in JS and came up with this algorithm. I am pretty sure this must have already been implemented but couldn't even find a clue over the web. The thing is, ...
2votes
1answer
86views
Generating a performance report for clans in Clash Royale
The following code generates a report showing performance of clan members in a game called Clash Royale. Everything is pretty self-explanatory, we are working with a lot of https requests, arrays and ...